<?php
	class Registry implements ArrayAccess
	{
		private $_vars = array();
		
		function set($key, $var) 
		{
			if (isset($this->_vars[$key]) == true) {
				throw new Exception('Unable to set var `' . $key . '`. Already set.');
			}
			$this->_vars[$key] = $var;
			return true;
		}
		
		function get($key) 
		{
			if (isset($this->_vars[$key]) == false) {
				return null;
			}
			return $this->_vars[$key];
		}
		
		function remove($var) 
		{
			unset($this->_vars[$key]);
		}
		
		function offsetExists($offset) 
		{
			return isset($this->_vars[$offset]);
		}
		
		function offsetGet($offset)
		{
			return $this->get($offset);
		}
		
		function offsetSet($offset, $value) 
		{
			$this->set($offset, $value);
		}
		
		function offsetUnset($offset) 
		{
			unset($this->_vars[$offset]);
		}
	}
?>